#define _CRT_SECURE_NO_WARNINGS

#include<stdio.h>

int main()
{
	int n = 0;
	scanf("%d", &n);
	int a = 0;
	int max = 0;
	int min = 100;
	for(int i=0;i<n;i++)
	{
		scanf("%d", &a);
		if (a > max)
			max = a;
		if (a < min)
			min = a;
	}
	printf("%d", max - min);
	return 0;
}


